package com.shadow.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.shadow.mapper.UserMapper;
import com.shadow.common.entity.User;
import com.shadow.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by shadow
 * on 2022-6-29.
 */
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    /**
     * 通过账户获取用户信息
     *
     * @param account 账户
     * @return {@link User}
     */
    @Override
    public User getUserByAccount(String account) {
        LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<User>()
                .eq(User::getAccount, account);
        return userMapper.selectOne(wrapper);
    }
}
